﻿@model HYBYSoft.Company.Models.Links
@{
    ViewBag.Title = "Edit";
    Layout = "~/Areas/Admin/Views/Shared/_LayoutPage1.cshtml";
}
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/UploadImage.js")" type="text/javascript"></script>
<script type="text/javascript">
    var uploadImg = new UploadImage();
</script>
<div id="content">
    <div style="margin-top: 10px;">
        <p>
            <span id="sitemap">当前位置：添加友情链接</span>
        </p>
    </div>
    @using (Html.BeginForm("Edit", "Links", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        @Html.ValidationSummary(true)
        <fieldset>
            <legend>友情链接&nbsp;&nbsp;@Model.Title &nbsp;&nbsp;编辑</legend>
            <div>
                @Html.HiddenFor(model => model.LinkID)
                <div class="editor-label">
                    @Html.LabelFor(model => model.Title)：
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Title)
                    @Html.ValidationMessageFor(model => model.Title)
                </div>
            </div>
            <div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Url)：
                </div>
                <div class="editor-field">
                    @Html.EditorFor(model => model.Url)
                    @Html.ValidationMessageFor(model => model.Url)
                </div>
            </div>
            <div style="height: 70px;">
                <div class="editor-label">
                </div>
                <div class="editor-field">
                    <div style="float: left; position: static;">
                        <div style="border: 1px solid #F4F4F4; margin-left: 10px; position: absolute;">
                            <div style="border: 1px solid #CCCCCC;">
                                <div id="divPic" style="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale);
                                    width: 50px; height: 50px;">
                                    @{
               if (Model.Icon == null || Model.Icon.Length == 0)
               {
                                        <img id="imgPic" alt="图片预览" src="../../../../Content/images/image_51x51.gif" width="50"
                                            height="50" />
               }
               else
               {
                                        <img id="imgPic" alt="链接图标" src="/UplodeImages/@Model.Icon"  width="50" height="50" />
               }
                                    }
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.Icon)：
                </div>
                <div class="editor-field">
                    <div style="float: left;">
                        @Html.ValidationMessageFor(model => model.Icon)
                        <input name="fuLoadImage" type="file" onchange='uploadImg.Upload(this,"divPic","imgPic");' />
                    </div>
                </div>
            </div>
            <div>
                <div class="editor-label">
                    @Html.LabelFor(model => model.IsShow)：
                </div>
                <div class="editor-field">
                    @{ 
               if (Model.IsShow == 1)
               { 
                        <input type="radio" name="rdiShowIndex" id="rdiShowIndex1" checked="checked" value="1" />@Html.Label("在首页显示")
                        <input type="radio" name="rdiShowIndex" id="rdiShowIndex2" value="0" />@Html.Label("不在首页显示")
               }
               else
               {
                        <input type="radio" name="rdiShowIndex" id="rdiShowIndex1" value="1" />@Html.Label("在首页显示")
                        <input type="radio" name="rdiShowIndex" id="rdiShowIndex2" checked="checked" value="0" />@Html.Label("不在首页显示")
            
               }

                    }
                    @*
                    <input type="radio" name="rdiShowIndex" id="rdiShowIndex1" checked="checked" value="1" />在首页显示<br />
                    <input type="radio" name="rdiShowIndex" id="rdiShowIndex2" value="0" />不在首页显示*@
                </div>
            </div>
            <center>
                <div style="margin-top: 10px; padding-top: 60px; padding-bottom: 8px;">
                    <input type="submit" value="确认提交" />
                </div>
            </center>
        </fieldset>
    }
    <div style="padding-left: 10px;">
        @Html.ActionLink("返回友情链接管理首页", "Index", new { page = ViewBag.PageId })
    </div>
</div>
